package com.study.web.entity;

import java.util.Date;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

import com.study.common.base.entity.BaseEntity;

/**
 * 系统操作权限实体类<br>
 * SysPermission.java
 * 
 * @author yaojinshan
 * @since 2018年6月11日下午4:54:13
 */
public class SysPermission extends BaseEntity {

	private static final long serialVersionUID = 772838977878418817L;
	/**
	 * 所需操作权限
	 */
	private String permission;
	/**
	 * 权限标识
	 */
	@NotEmpty(message="权限标识不能为空")
	@Size(max = 15, min = 6,message = "权限标识长度必须在6到15之间")
	@Pattern(regexp="^[a-zA-Z0-9_-]+$",message="'权限标识只能输入数字、字母、下划线、横线")
	private String enName;
	/**
	 * 权限名称
	 */
	@NotEmpty(message="权限名称不能为空")
	@Size(max = 15, min = 2,message = "权限名称长度必须在2到15之间")
	@Pattern(regexp="^[\u4e00-\u9fa5]+$",message="权限名称只能输入汉字")
	private String zhName;
	/**
	 * 权限级别 1 超级管理员 默认2 普通管理员 ...
	 */
	private Integer level;
	/**
	 * 权限地址
	 */
	private String url;
	/**
	 * 父编码
	 */
	@NotNull(message="父编码不能为空")
	private Long parentId;
	/**
	 * 权限类型 默认 1 板块菜单 ,2 模块菜单,3 页面菜单,4 按钮操作
	 */
	@NotNull(message="权限类型不能为空")
	private Integer permissionType;
	/**
	 * 创建者id
	 */
	private Long createrId;
	/**
	 * 更新人id
	 */
	private Long updaterId;
	/**
	 * 更新时间
	 */
	private Date updateTime;
	/**
	 * 状态 默认 1 启用 2 禁用
	 */
	@NotNull(message="权限状态不能为空")
	private Integer status;
	/**
	 * 权限备注/说明
	 */
	private String remark;

	public String getPermission() {
		return permission;
	}

	public void setPermission(String permission) {
		this.permission = permission == null ? null : permission.trim();
	}

	public String getEnName() {
		return enName;
	}

	public void setEnName(String enName) {
		this.enName = enName == null ? null : enName.trim();
	}

	public String getZhName() {
		return zhName;
	}

	public void setZhName(String zhName) {
		this.zhName = zhName == null ? null : zhName.trim();
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url == null ? null : url.trim();
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public Integer getPermissionType() {
		return permissionType;
	}

	public void setPermissionType(Integer permissionType) {
		this.permissionType = permissionType;
	}

	public Long getCreaterId() {
		return createrId;
	}

	public void setCreaterId(Long createrId) {
		this.createrId = createrId;
	}

	public Long getUpdaterId() {
		return updaterId;
	}

	public void setUpdaterId(Long updaterId) {
		this.updaterId = updaterId;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark == null ? null : remark.trim();
	}

	/**
	 * @return String
	 */
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(getId());
		sb.append(", permission=").append(permission);
		sb.append(", enName=").append(enName);
		sb.append(", zhName=").append(zhName);
		sb.append(", level=").append(level);
		sb.append(", url=").append(url);
		sb.append(", parentId=").append(parentId);
		sb.append(", permissionType=").append(permissionType);
		sb.append(", createrId=").append(createrId);
		sb.append(", createTime=").append(getCreateTime());
		sb.append(", updaterId=").append(updaterId);
		sb.append(", updateTime=").append(updateTime);
		sb.append(", status=").append(status);
		sb.append(", remark=").append(remark);
		sb.append("]");
		return sb.toString();
	}
}